import React, {Component} from 'react';

const SimpleHoc = (WrappedComponent) => {
    return class extends Component {
        constructor(props) {
            super(props);
            this.state = {
                name: "你好"
            };
        }

        onClick = () => {
            let {name} = this.state;
            console.log(name);
            this.setState({
                name: "你好啊"
            }, () => {
                console.log(this.state.name);
            })
        };

        render() {
            console.log({...this.props})
            return (
                <WrappedComponent {...this.props} onClick={this.onClick}/>
            )
        }
    }
};

export default SimpleHoc;